<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jQuery 发送请求</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
    <button>发送 GET 请求</button>
    <button>发送 POST 请求</button>

    <script>
        $('button').eq(0).click(function(){
            //发送请求
            // $.get(url, data, fn);
            $.get('http://127.0.0.1/server', {id: 100, name: 'zhangsan'}, function(data){
                console.log(data);
            })
        });

        $('button').eq(1).click(function(){
            $.post('http://127.0.0.1/server', {id: 100, name: 'zhangsan'}, function(data){
                console.log(data);
            })
        });
    </script>
</body>
</html>